<?php
/* @var $this StkProductoController */
/* @var $dataProvider CActiveDataProvider */
/*
$this->breadcrumbs=array(
	'Productos',
);*/
	$baseUrl = Yii::app()->baseUrl; 
	$cs = Yii::app()->getClientScript();	
	//$cs->registerScriptFile($baseUrl.'/js/jquery-1.10.1.min.js');
	$cs->registerScriptFile($baseUrl.'/js/jquery-1.9.0.min.js');
	$cs->registerScriptFile($baseUrl.'/js/jquery.nivo.slider.js');
 	$cs->registerScriptFile($baseUrl.'/js/script-slider-p.js');
	//Import CSS
	$cs->registerCssFile($baseUrl.'/css/nivo-slider.css');
	$cs->registerCssFile($baseUrl.'/css/default/default.css');


	$root = (isset(Yii::app()->user->Rol) and Yii::app()->user->Rol=="SuperUsuario") ? true : false;
	$admin = (isset(Yii::app()->user->Rol) and Yii::app()->user->Rol=="Administrador") ? true : false;
	$this->menu=array(
		array('label'=>'Crear Producto', 'url'=>array('create'), 'visible'=>$root),
		array('label'=>'Gestionar Producto', 'url'=>array('admin'), 'visible'=>$root),
		array('label'=>'Crear Producto', 'url'=>array('create'), 'visible'=>$admin),
		array('label'=>'Gestionar Producto', 'url'=>array('admin'), 'visible'=>$admin),
	);
	
?>
<?php
	//$model= new StkProducto;
	$data =$dataProvider->getData();//Producto
	$dataCat=$dataCat->getData();//Categoria
	?>
	<div id="submenu">
		<?php foreach($dataCat as $datas)
		{
			?> <?php
			Yii::app()->clientscript->scriptMap['/js/script-slider-p.js'] = false;
			echo CHtml::ajaxLink ($datas->Nombre,
                              CController::createUrl('detail',array('type' => 'POST','id'=>$datas->Id)), 
                              array('replace' => '#Description'),
							  array('onclick'=>'$("#slider-in").prepend($("<div>").addClass("nivoSlider").offset({ top: 150, left: 500 }) )')
							 );?>
			|		
		<?php } ?>
	</div>
	
	<div id="Description" class="content-inner2">
		
		<h1 class="tit-in">
			<?php echo $dataCat[0]->Nombre;?>
		</h1>
		<div id="left-menu">
			<li>
			<?php
				
				foreach($data as $datas){?>
					<ul><?php 
							if($datas->Categoria_Id==$dataCat[0]->Id && $datas->Estado!="E")
							echo CHtml::ajaxLink ($datas->Nombre,
                              CController::createUrl('Productdetail',array('type'=>'GET','id'=>$datas->Id)), 
                              array('replace' => '#pro-content'),
							  array('onclick'=>'$("#slider-in").append($("<div>").addClass("nivoSlider2") )'));?></ul>
				<?php
				} ?>
			</li>
		</div>
		<div id="pro-content">
			<div id="pro-cont-txt"><strong style="color:#fff; text-transform:uppercase;">
				Características
				</strong><br></br>
				<?php echo $data[0]->Texto;?>
			</div>
			<div class="slider-wrapper theme-default">
				<div id="slider-in" class="nivoSlider">
				<?php
				$criteria = new CDbCriteria;
				$criteria=array('condition'=>('Producto_Id=:id AND Estado!="E"'), 'params'=>array(':id'=>$data[0]->Id));
				$model = StkImagen::model()->findAll($criteria);
				echo $model->Nombre;
				?>
				<?php foreach($model as $iter){ ?>
				<img src="<?php echo "images/uploads/".$iter->Url; ?>" alt="" title="" />
				<?php } ?>
				<!--
					<img src="images/productos/foto5.jpg" alt="" title="" />
					<img src="images/productos/foto3.jpg" alt="" title="" />
					<img src="images/productos/foto1.jpg" alt="" title="" />
					<img src="images/productos/foto2.jpg" alt="" title="" />
					<img src="images/productos/foto4.jpg" alt="" title="" />-->
					
				</div>
			</div>
			
		</div>
	</div>
	
	

